public class ConcreteMediator extends Mediator {
    private Button addButton;
    private Button deleteButton;
    private List customerList;
    private ComboBox customerComboBox;
    private TextBox customerTextBox;

    public void setAddButton(Button addButton) {
        this.addButton = addButton;
    }

    public void setDeleteButton(Button deleteButton) {
        this.deleteButton = deleteButton;
    }

    public void setCustomerList(List customerList) {
        this.customerList = customerList;
    }

    public void setCustomerComboBox(ComboBox customerComboBox) {
        this.customerComboBox = customerComboBox;
    }

    public void setCustomerTextBox(TextBox customerTextBox) {
        this.customerTextBox = customerTextBox;
    }

    @Override
    public void componentChanged(Component component) {
        if (component == addButton) {
            String customer = customerTextBox.getText();
            customerList.add(customer);
            customerComboBox.add(customer);
            System.out.println("添加客户：" + customer);
            System.out.println("当前列表：" + customerList.getItems());
            System.out.println("当前组合框：" + customerComboBox.getItems());
        } else if (component == deleteButton) {
            String customer = customerList.getSelectedValue();
            customerList.remove(customer);
            customerComboBox.remove(customer);
            System.out.println("删除客户：" + customer);
            System.out.println("当前列表：" + customerList.getItems());
            System.out.println("当前组合框：" + customerComboBox.getItems());
        }
    }
}
